<template>
  <div class="worker">
    <el-dialog
      :visible.sync="showDialog"
      width="100%"
      top="0"
      :close-on-click-modal="false"
      :lock-scroll="true"
      @close="close"
    >
      <div slot="title">
        <h4>{{form.id ? '编辑工作经历' : '添加工作经历'}}</h4>
      </div>
      <el-form ref="form" :model="form" :rules="rules" :inline="true">
        <el-form-item label="工作开始时间" prop="start_time">
          <el-date-picker
            v-model="form.start_time"
            value-format="yyyy-MM"
            format="yyyy-MM"
            type="month"
            placeholder="请选择"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="工作结束时间" prop="end_time">
          <el-date-picker
            v-model="form.end_time"
            value-format="yyyy-MM"
            format="yyyy-MM"
            type="month"
            placeholder="请选择"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="工作单位" prop="work_unit">
          <el-input placeholder="请输入" v-model="form.work_unit"></el-input>
        </el-form-item>
        <el-form-item label="职务" prop="post">
          <el-input placeholder="请输入" v-model="form.post"></el-input>
        </el-form-item>
        <el-form-item label="离职原因" prop="leave_reason">
          <el-input type="textarea" placeholder="请输入" v-model="form.leave_reason"></el-input>
        </el-form-item>
        <el-form-item label="证明人" prop="voucher">
          <el-input placeholder="证明人" v-model="form.voucher"></el-input>
        </el-form-item>
        <el-form-item label="证明人电话" prop="voucher_phone">
          <el-input placeholder="证明人电话" v-model="form.voucher_phone"></el-input>
        </el-form-item>
        <el-form-item label="工作备注" prop="remark">
          <el-input type="textarea" placeholder="请输入" v-model="form.remark"></el-input>
        </el-form-item>

        <el-button style="width: 100%" type="success" @click="finished">保存</el-button>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import common from '../mixins/common'
export default {
  name: 'Worker',
  props: ['isVisible', 'row'],
  mixins: [common],
  data () {
    return {
      showDialog: false,
      form: {},
      rules: {
        work_unit: [{ required: true, message: '请输入工作单位', trigger: 'blur' }]
      },
      educationList: [],
      editUrl: '/home/worker/save',
      delUrl: '/home/worker/del'
    }
  }
}
</script>
